var app = getApp()
Page({
  data: {
    page: 0,
    noMoretip: false,
    showLoading: true
  },
  onLoad: function (e) {
    var that = this;  
    app.setNavtitle('积分兑换');
    that.setData({
      actid:e.actid,
      totalPoints: e.totalPoints,
      pointsCost: e.pointsCost
    })
  },
  requestExchangepoint: function () {
    var that = this;
    var actid = that.data.actid;
    wx.showLoading({
      title: '加载中',
    })
    wx.request({
      url: app.globalData.requestUrl,
      data: {
        map: 'applet_meeting_exchange_pnum',
        id: actid
      },
      success: function (res) {
        console.log(res);
        if (res.data.ec == 200) {
          // that.setData({
          //   totalPoints: res.data.data.points
          // })
          app.errorTip(that, res.data.data.msg, 2000);
          setTimeout(function(){
            wx.navigateBack({
              delta:1
            })
          },1000)
        } else {
          console.log(res.data)
          app.errorTip(that, res.data.em, 2000);
        }
      },
      complete: function () {
        wx.hideLoading();
      }
    });
  },
})